﻿Imports Alquilaqi
Public Class InmuebleModificar

    Public inmuebleForm As InmuebleMain

    Private Sub Buscarbt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buscarbt.Click

        Dim criterio As String = Me.buscarT.Text
        'MsgBox(criterio)

        Dim negocio As New InmuebleNegocio
        Dim inmueble As Collection = negocio.buscarPorNombre(criterio)
        Me.dginmueble.DataSource = inmueble
        Me.dginmueble.EditMode = False

        If inmueble.Count > 0 Then
            Me.dginmueble.Columns(0).HeaderText = "Id"
            Me.dginmueble.Columns(1).Visible = False
            Me.dginmueble.Columns(2).Visible = False
            Me.dginmueble.Columns(3).Visible = False
            Me.dginmueble.Columns(4).HeaderText = "Precio"
            Me.dginmueble.Columns(5).Visible = False
            Me.dginmueble.Columns(6).Visible = False
            Me.dginmueble.Columns(7).Visible = False
            Me.dginmueble.Columns(8).HeaderText = "Foto1"
            Me.dginmueble.Columns(9).HeaderText = "Foto2"
            Me.dginmueble.Columns(10).HeaderText = "Estado"
            Me.dginmueble.Columns(11).Visible = False
            Me.dginmueble.Columns(12).HeaderText = "Valoración"
        End If

        With Me.dginmueble.ColumnHeadersDefaultCellStyle
            .BackColor = Color.Red
            .ForeColor = Color.White
        End With
    End Sub

    Private Sub Editarbt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Editarbt.Click
        Dim seleccionado = Me.dginmueble.CurrentRow.Cells(0).Value.ToString
        Dim form As New ModificarInmueble
        form.idlabel.Text = seleccionado
        form.modificarform = Me
        form.Show()
    End Sub

    Private Sub InmuebleModificar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class